import java.util.Arrays;

public class Test3 {
    public static int func(int[] array){
        int[] temp = new int[array.length];
        int c = 0;
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = i+1; j < array.length; j++) {
                if(array[i] == array[j]){
                    temp[c] = array[i];
                    c++;
                    break;
                }
            }
        }
        int count = 0;
        for (int i = 0;i < temp.length;i++){
            array[i] = temp[i];
            count++;
        }
        return count;

    }
    public static void main(String[] args) {
        int[] array = {1,1,5,5,7,7,4,4,6,6,2,2,3,3};
        int ret = func(array);
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));
        System.out.println(ret);
    }
}
